home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revolution - Das Atari CD Magazin 1997
/
Revolution - Das Atari CD Magazin 1.iso
/
software
/
anwendng
/
qed_397
/
sourcen
/
global.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-14
|
23KB
|
1,015 lines
#include "global.h"
#include "fontsel.h"
#include "fsel.h"
#include "magx.h"
#include "mintlib.h"
#include "obj.h"
#include "rsc.h"
#include "scroll.h"
#include "set.h"
/*
* exportierte Variablen
*/
GLOBAL WORD phys_handle; /* Physikalisches Workstation Handle */
GLOBAL WORD gl_apid; /* Identifikation für Applikation */
GLOBAL WORD gl_wchar; /* Je nach aktuellem Font z.B. 8*16 */
GLOBAL WORD gl_hchar;
GLOBAL WORD sys_wchar; /* 8*16 */
GLOBAL WORD sys_hchar;
GLOBAL WORD sys_wbox; /* 19*19 */
GLOBAL WORD sys_hbox;
GLOBAL WORD min_ascii;
GLOBAL WORD max_ascii;
GLOBAL WORD fill_color; /* aktuell eingestellte Füllfarbe */
GLOBAL WORD planes; /* Anzahl der Planes */
GLOBAL WORD gem; /* GEM-Version */
GLOBAL BOOLEAN mint; /* MiNT aktiv? */
GLOBAL BOOLEAN aes41; /* MultiTOS aktiv? */
GLOBAL WORD magx; /* Mag!X da */
GLOBAL BOOLEAN gdos; /* GDOS vorhanden? */
GLOBAL BOOLEAN global_shift; /* bei aktueller Opertion wurde Shift gedrückt */
GLOBAL BOOLEAN quick_close; /* Sichern der Texte ohne Nachfrage */
GLOBAL WORD vdi_handle; /* Virtuelles Workstation Handle */
GLOBAL RECT desk; /* Bildschirm-Größe z.B. 0, 19, 640, 381 */
GLOBAL BOOLEAN done; /* Ende gewählt ? */
GLOBAL PATH qed_path; /* Name und Pfad der qed-Datei */
GLOBAL PATH app_path; /* Pfad der Applikation */
GLOBAL PATH scrapdir; /* Clipboard-Pfad */
GLOBAL struct tm *local_time; /* enthält die aktuelle Uhrzeit */
GLOBAL WORD desire_x, return_code;
GLOBAL LONG desire_y, undo_y;
/****** DEFINES **************************************************************/
#define CTRL_CHAR '^' /* Menü-Control-Buchstabe */
#define ALT_CHAR 0x07 /* Menü-Alternate-Buchstabe */
#define MFILE_ANZ 10 /* Anzahl für Selectric & Komp. */
/****** TYPES ****************************************************************/
/****** VARIABLES ************************************************************/
LOCAL WORD hidden = 0;
LOCAL WORD act_mousenumber = 0;
LOCAL WORD last_mousenumber = 0;
LOCAL BOOLEAN sleep = FALSE;
LOCAL RECT clip; /* Letztes Clipping Rechteck */
LOCAL BOOLEAN clip_flag;
LOCAL BOOLEAN ext_fsel; /* erweitertes Fileselect-Box möglich */
LOCAL PATH fs_path; /* Pfad der Dateiauswahl-Box */
LOCAL FSEL default_fsel; /* Suffix und Name in Box */
LOCAL UBYTE *slct_files[MFILE_ANZ];
LOCAL LONG _idt; /* Cookie für Datum und Zeit */
/****** FUNCTIONS ************************************************************/
/*****************************************************************************/
/* Öffne virtuelle Workstation */
/*****************************************************************************/
WORD open_vwork (WORD *w_out)
{
WORD i, handle;
WORD work_in[11];
for (i = 0; i < 11; i++)
work_in[i] = 1;
work_in[5] = 0;
work_in[9] = WHITE; /* Füllfarbe */
work_in[10] = RC; /* Raster Koordinaten */
handle = phys_handle;
v_opnvwk (work_in, &handle, w_out); /* Öffne virtuelle Workstation */
return (handle);
}
/*****************************************************************************/
/* Maus-Routinen */
/*****************************************************************************/
VOID Set_mouse (WORD number)
{
last_mousenumber = act_mousenumber;
act_mousenumber = number;
Wake_mouse();
graf_mouse (number, NULL);
sleep = FALSE;
}
WORD Get_mouse(VOID)
{
return act_mousenumber;
}
BOOLEAN Mouse_sleeps(VOID)
{
return sleep;
}
VOID Sleep_mouse (VOID)
{
if (!sleep)
{
sleep = TRUE;
if (hidden==0) graf_mouse (M_OFF, NULL);
}
}
VOID Wake_mouse (VOID)
{
if (sleep)
{
sleep = FALSE;
if (hidden==0) graf_mouse (M_ON, NULL);
}
}
VOID Last_mouse (VOID)
{
Set_mouse (last_mousenumber);
}
VOID Hide_mouse ()
{
if (hidden==0 && !sleep) graf_mouse (M_OFF, NULL);
hidden++;
}
VOID Show_mouse ()
{
if (--hidden==0 && !sleep) graf_mouse (M_ON, NULL);
}
VOID Busy_mouse ()
{
Set_mouse (HOURGLASS);
}
VOID Arrow_mouse ()
{
Set_mouse (ARROW);
}
/*****************************************************************************/
/* Ausgabe recht oben im Menü */
VOID print_headline(UBYTE *str)
{
WORD ret, len, width;
set_clip(FALSE, NULL);
vst_font (vdi_handle, sys_font_id); /* Systemfont */
vst_point (vdi_handle, sys_font_size, &ret, &ret, &width, &ret);
len = (short) strlen(str);
v_gtext(vdi_handle, desk.w-len * width, 0, str);
vst_font (vdi_handle, winFont.ID);
vst_point (vdi_handle, winFont.Size, &ret, &ret, &ret, &ret);
}
/*****************************************************************************/
LOCAL LONG maxvalue;
LOCAL DIALINFO aktion_box;
VOID start_aktion(const UBYTE *head, BOOLEAN inter, LONG max_value)
{
maxvalue = max(max_value, 1);
fill_ptext(aktion, ATEXT, head);
aktion[ABOX2].ob_width = 1;
hide_objc(aktion, AESC, !inter);
open_dial(aktion, TRUE, NULL, &aktion_box);
dial_draw(&aktion_box);
}
VOID do_aktion (LONG value)
{
LONG max_len, help;
max_len = aktion[ABOX1].ob_width;
help = max((max_len * value) / maxvalue,1);
help = min(max_len, help);
if (aktion[ABOX2].ob_width != help)
{
aktion[ABOX2].ob_width = (short) help;
draw_Objc(aktion, ABOX2, 1);
}
}
VOID end_aktion (VOID)
{
dial_end(&aktion_box);
}
/*****************************************************************************/
VOID str_upper(UBYTE *str)
{
while (*str != EOS)
{
*str = nkc_toupper(*str);
str++;
}
}
VOID str_lower(UBYTE *str)
{
while (*str != EOS)
{
*str = nkc_tolower(*str);
str++;
}
}
/*****************************************************************************/
BOOLEAN str_to_key(UBYTE *str, MKINFO *mk)
{
UBYTE c, sign, *s1, *s2;
BOOLEAN erg = FALSE;
if ((str[0] == EOS) || (mk == NULL))
return FALSE;
s1 = strrchr(str, CTRL_CHAR);
s2 = strrchr(str, ALT_CHAR);
if (s1 > s2)
str = s1;
else
str = s2;
if (str!=NULL && strlen(str)>=2) /* Sign und Buchstabe */
{
sign = *str++; /* "Vorzeichen" */
c = *str; /* Eigentliches Zeichen */
switch (sign)
{
case CTRL_CHAR:
mk->kstate = K_CTRL;
mk->kreturn = NKF_FUNC|NKF_CTRL|c;
mk->ascii_code = c;
mk->scan_code = 0;
mk->shift = FALSE;
mk->ctrl = TRUE;
mk->alt = FALSE;
erg = TRUE;
break;
case ALT_CHAR:
mk->kstate = K_ALT;
mk->kreturn = NKF_FUNC|NKF_ALT|c;
mk->ascii_code = c;
mk->scan_code = 0;
mk->shift = FALSE;
mk->ctrl = FALSE;
mk->alt = TRUE;
erg = TRUE;
break;
}
}
return erg;
}
/*****************************************************************************/
BOOLEAN inside (WORD x, WORD y, const RECT *r)
{
return (x>=r->x && y>=r->y && x<r->x+r->w && y<r->y+r->h);
} /* inside */
/*****************************************************************************/
BOOLEAN get_clip (RECT *size)
{
*size = clip;
return clip_flag;
}
VOID set_clip (BOOLEAN clipflag, const RECT *size)
{
WORD xy[4];
if (!clip_flag && !clipflag) return; /* Es ist aus und bleibt aus */
clip_flag = clipflag;
if (clipflag)
{
if (size == NULL)
clip = desk; /* Nichts definiert, nimm Desktop */
else
{
clip = *size; /* Benutze definierte Größe */
if (!myrc_intersect (&desk, &clip))/* Nur auf Desktop zeichnen */
{
clip.x = 0; /* Nichts zeichnen */
clip.y = 0;
clip.w = 0;
clip.h = 0;
}
}
rect2array(&clip,xy);
}
else
clip = desk;
vs_clip (vdi_handle, clipflag, xy); /* Setze Rechteckausschnitt */
} /* set_clip */
/*****************************************************************************/
WORD note (WORD button, WORD index)
{
WORD ret;
Arrow_mouse ();
ret = do_alert(button, (BYTE *)alertmsg[index]);
Last_mouse ();
return (ret);
} /* note */
/*****************************************************************************/
WORD inote(WORD button, WORD index, LONG i)
{
UBYTE str[20];
ltoa(i,str,10);
return snote(button,index,str);
}
/*****************************************************************************/
WORD snote (WORD button, WORD index, UBYTE *str)
{
WORD ret, len;
UBYTE s[200], *ptr;
len = (short) strlen(str);
strcpy(s, alertmsg[index]);
ptr = strchr(s,'$');
if (ptr!=NULL)
{
MOVE(ptr+len, ptr+1, (short) strlen(ptr));
COPYB(ptr,str,len);
}
Arrow_mouse ();
ret = do_alert (button, (BYTE *)s);
Last_mouse ();
return (ret);
} /* inote */
/***************************************************************************/
/* Verschiedenes */
/***************************************************************************/
VOID make_shortpath(const UBYTE *path, UBYTE *shortpath, WORD maxlen)
{
PATH help;
WORD path_len;
UBYTE *p1, *p2;
strcpy(help,path);
path_len = (short) strlen(help);
if (maxlen < 18)
{
file_name(path,help, FALSE);
}
else if (path_len>maxlen)
{
p1 = strchr(help,'\\');
p2 = p1;
path_len += 2; /* zwei Punkte neu */
while(*p2!=EOS && path_len>maxlen)
{
p2++;
while(*p2!='\\' && *p2!=EOS)
{
p2++;
path_len--;
}
}
if (*p2!=EOS)
{
MOVE(p1+3, p2, (short)strlen(p2)+1);
p1[1] = '.';
p1[2] = '.';
}
else
{
p2 = strrchr(help,'\\');
MOVE(help, p2, (short)strlen(p2)+1);
}
}
strcpy(shortpath,help);
}
/* Macht aus allem einen kompletten Pfad */
/* evtl. vorhandene Dateinamen bleiben erhalten */
/* with_filename = hat ganz sicher Dateinamen */
BOOLEAN make_normalpath(UBYTE *path, BOOLEAN with_filename)
{
WORD i;
PATH p;
UBYTE *f, drv;
if (path[0] == EOS)
return FALSE;
if (path[0] == '/') /* UNIX-Pfad */
unx2dos(path);
/* Laufwerk bestimmen */
if (path[1] != ':') /* Kein Laufwerk */
{
drv = 'A' + Dgetdrv(); /* aktuelles Laufwerk */
if (drv > 'Z')
drv = drv - 'Z' + '0'; /* A..Z 1..6 */
f = path;
}
else
{
path[0] = nkc_toupper(path[0]);
drv = path[0];
if (drv > 'Z')
drv = drv - 'Z' + '0'; /* A..Z 1..6 */
f = path + 2;
}
/* Pfad mit Laufwerk bestimmen */
if (f[0]=='.' && (f[1]=='\\' || f[1]==EOS))
{
get_path(p, drv); /* aktuellen Pfad nehmen */
if (f[1]=='\\') strcat(p,f+2);
}
else if (f[0]!='\\') /* Keine Root */
{
get_path(p, drv);
strcat (p, f);
}
else
{
p[0] = drv;
p[1] = ':';
p[2] = EOS;
strcat (p, f);
}
if (!with_filename) /* herausbekommen ob Dateiname */
{
i = (short) strlen(p);
if (p[i-1]!='\\')
{
p[i] = '\\';
p[i+1] = EOS;
}
if (!path_exist(p))
p[i] = EOS;
}
strcpy(path,p);
return TRUE;
} /* make_normalpath */
VOID make_ext(UBYTE *fullname, const UBYTE *ext)
{
UBYTE *ptr;
ptr = strrchr(fullname,'.');
if (ptr == NULL || ptr < strrchr(fullname,'\\'))
{
ptr = fullname + strlen(fullname);
*ptr = '.';
}
if (caseSens(fullname, NULL))
strcpy(ptr+1, ext);
else
{
UBYTE myext[5];
strcpy(myext, ext);
str_upper(myext);
strcpy(ptr+1, myext);
}
}
VOID file_name(const UBYTE *fullname, UBYTE *filename, BOOLEAN withoutExt)
{
file_splitt(fullname, NULL, filename);
if (withoutExt)
{
UBYTE *p;
p = strrchr(filename, '.');
if (p != NULL)
*p = EOS;
}
}
VOID file_splitt(const UBYTE *fullname, UBYTE *path, UBYTE *name)
{
UBYTE *str;
str = strrchr (fullname, '\\');
if (path != NULL)
path[0] = EOS; /* schadet nix */
if (name != NULL)
name[0] = EOS; /* ditto */
if (str != NULL)
{
/* Dateinamen holen */
if (name != NULL)
strcpy(name, str+1);
/* Pfad mit Laufwerk bestimmen */
if (path != NULL)
{
WORD len = (short)( str - (UBYTE *)fullname + 1);
strncpy(path, fullname, len);
path[len] = EOS;
}
}
} /* file_split */
/*****************************************************************************/
WORD get_first_drive(VOID)
{
ULONG drives;
WORD drive;
drives = Dsetdrv(Dgetdrv()); /* Alle Laufwerke */
if (drives == 0)
drive = -1;
else if (drives <= 3)
drive = 0; /* Benutze Laufwerk A */
else
{
drives >>= 2;
drive = 2; /* Beginne bei Laufwerk C */
while (!(drives & 1) && drive < 32) /* Laufwerk gefunden */
{
drive++;
drives >>= 1;
}
}
return drive;
}
/*****************************************************************************/
VOID drive_name(WORD drive, UBYTE *name)
{
UBYTE n[]="A:\\*.*" ;
DTA dta, *old_dta;
old_dta = Fgetdta();
Fsetdta (&dta);
n[0] = 'A' + (drive - 1);
if (Fsfirst (n, FA_VOLUME) == 0)
strcpy(name, dta.d_fname);
else
name[0] = EOS;
Fsetdta (old_dta);
}
/*****************************************************************************/
VOID get_drive_space(WORD drive, ULONG *total, ULONG *free)
{
DISKINFO info;
WORD err;
ULONG help;
err = Dfree(&info, drive);
if (!err)
{
help = (info.b_secsiz * info.b_clsiz);
if (total != NULL)
*total = (info.b_total*help); /* Byte */
if (free != NULL)
*free = (info.b_free * help); /* Byte */
}
else
{
if (free != NULL)
*free = 0;
if (total != NULL)
*total = 0;
}
}
/*****************************************************************************/
BOOLEAN get_path (UBYTE *path, UBYTE drive)
{
WORD ret, drive_nr;
if (drive == 0)
{
drive = 'A' + Dgetdrv(); /* Aktuelles Laufwerk */
if (drive > 'Z')
drive = drive - 'Z' + '0';
}
else
drive = nkc_toupper(drive);
if (drive >= '1' && drive <= '6') /* Laufwerk nach Z mit Big-DOS oder MetaDOS > 2.60 */
drive_nr = drive - '1' + 26;
else
drive_nr = drive - 'A';
path[0] = drive;
path[1] = ':';
ret = Dgetpath (path + 2, drive_nr + 1);
strcat (path, "\\");
return (ret == 0);
} /* get_path */
BOOLEAN set_path(UBYTE *path)
{
WORD drive, ret;
if (path[0] == EOS)
return FALSE;
path[0] = nkc_toupper(path[0]);
if (path[0] >= '1' && path[0] <= '6')
drive = path[0] - '1' + 26;
else
drive = path[0] - 'A';
Dsetdrv(drive);
ret = Dsetpath(path + 2);
return (ret == 0);
}
/*****************************************************************************/
LOCAL VOID make_time(unsigned LONG ltime, UBYTE *date, UBYTE *time)
{
WORD year, month, day;
if (time != NULL)
{
strcpy(time,"00:00:00");
time[6] += (((unsigned)ltime&31)*2) / 10;
time[7] += (((unsigned)ltime&31)*2) % 10;
ltime>>=5;
time[3] += ((unsigned)ltime&63) / 10;
time[4] += ((unsigned)ltime&63) % 10;
ltime>>=6;
time[0] += ((unsigned)ltime&31) / 10;
time[1] += ((unsigned)ltime&31) % 10;
ltime>>=5;
}
else
ltime>>=16;
if (date != NULL)
{
day = (unsigned)ltime & 31;
ltime >>= 5;
month = (unsigned)ltime & 15;
ltime >>= 4;
year = ((unsigned)ltime & 127) + 1980;
switch ((UWORD)_idt & 0xF00) /* Reihenfolge im Datum */
{
case 0x000: /* MM/DD/YYYY */
sprintf(date, "%02d%c%02d%c%d", month, (UBYTE)(_idt&0xFF), day, (UBYTE)(_idt&0xFF), year);
break;
case 0x100: /* DD.MM.YYYY */
sprintf(date, "%02d%c%02d%c%d", day, (UBYTE)(_idt&0xFF), month, (UBYTE)(_idt&0xFF), year);
break;
default: /* YYYY-MM-DD */
sprintf(date, "%d%c%02d%c%02d", year, (UBYTE)(_idt&0xFF), month, (UBYTE)(_idt&0xFF), day);
break;
}
}
}
/*****************************************************************************/
VOID get_datum(UBYTE *date)
{
make_time(Gettime(),date,NULL);
}
/*****************************************************************************/
LONG file_time(const UBYTE *filename, UBYTE *date, UBYTE *time)
{
LONG ltime, ret;
XATTR attr;
ret = Fxattr(0, (UBYTE *)filename, &attr);
if (ret == 0)
{
ltime = (LONG)(UWORD)attr.mtime + ((LONG)(UWORD)attr.mdate << 16);
make_time(ltime, date, time);
}
else
{
DTA dta, *old_dta;
old_dta = Fgetdta();
Fsetdta (&dta);
if (Fsfirst((UBYTE*)filename, 0x17) == 0)
{
ltime = (LONG)dta.d_time+((LONG)dta.d_date<<16);
make_time(ltime, date, time);
}
else
{
ltime = 0L;
if (date!=NULL)
date[0] = EOS;
if (time!=NULL)
time[0] = EOS;
}
Fsetdta (old_dta);
}
return ltime;
}
/*****************************************************************************/
LONG file_size(const UBYTE *filename)
{
LONG size = 0L,
ret;
XATTR attr;
ret = Fxattr(0, (UBYTE *)filename, &attr);
if (ret == 0)
size = attr.size;
else
{
DTA dta, *old_dta;
old_dta = Fgetdta();
Fsetdta (&dta);
if (Fsfirst((UBYTE*)filename, 0x17) == 0)
size = (LONG)dta.d_length;
Fsetdta (old_dta);
}
return size;
}
/*****************************************************************************/
BOOLEAN file_exist (const UBYTE *filename)
{
XATTR attr;
LONG ret;
ret = Fxattr(0, (UBYTE *)filename, &attr);
if (ret != 0)
{
DTA dta, *old_dta;
old_dta = (DTA *)Fgetdta ();
Fsetdta (&dta);
ret = Fsfirst ((UBYTE*)filename, 0x17);
Fsetdta (old_dta);
}
return (ret == 0);
} /* file_exist */
/*****************************************************************************/
BOOLEAN file_readonly (const UBYTE *filename)
{
BOOLEAN result = FALSE;
XATTR attr;
LONG ret;
ret = Fxattr(0, (UBYTE *)filename, &attr);
if (ret == 0)
{
WORD uid, gid;
uid = Pgetuid();
gid = Pgetgid();
if (uid != -32 && gid != -32) /* gibts Pget[ug]id ? */
{
if (((uid == attr.uid) && ((attr.mode & S_IWUSR) != 0)) || /* Besitzer hat Schreibrecht */
((gid == attr.gid) && ((attr.mode & S_IWGRP) != 0)) || /* Gruppe hat Schreibrecht */
(((attr.mode & S_IWOTH) != 0)) || /* Welt hat Schreibrecht */
((uid == 0) && ((attr.mode & S_IWUSR) != 0))) /* root darf, wenn Owner darf */
result = FALSE;
else
result = TRUE;
}
else
result = ((attr.attr & FA_READONLY) != 0);
}
else
{
DTA dta, *old_dta;
old_dta = (DTA *)Fgetdta ();
Fsetdta (&dta);
result = (Fsfirst ((UBYTE*)filename, 0x00) == 0);
if (result)
result = (dta.d_attrib&FA_READONLY) != 0;
else
result = FALSE;
Fsetdta (old_dta);
}
return (result);
} /* file_readonly */
/*****************************************************************************/
BOOLEAN path_exist(const UBYTE *pathname)
{
BOOLEAN result;
PATH s;
WORD l;
if (pathname[0] == EOS)
return FALSE;
strcpy (s, pathname);
l = (short) strlen (s)-1;
s[l] = EOS;
if (l==2 && s[1]==':')
{
return TRUE;
}
else
{
LONG ret;
ret = Dopendir(s, 0);
if (ret == -32) /* kein Dopendir */
{
DTA dta, *old_dta;
old_dta = (DTA *)Fgetdta ();
Fsetdta (&dta);
result = (Fsfirst (s, 0x10)==0 && (dta.d_attrib&0x10));
Fsetdta (old_dta);
}
else
{
result = ((ret & 0xff000000L) != 0xff000000L) ; /* 0xff im obersten Byte? */
if (result)
Dclosedir(ret) ;
}
return (result);
}
} /* path_exist */
/*****************************************************************************/
/* Dateiauswahl */
/*****************************************************************************/
VOID set_fsel_path(const UBYTE *path)
{
PATH p;
file_splitt(path, p, NULL);
if (path_exist(p))
strcpy(fs_path, p);
}
BOOLEAN select_file (FSEL *fsel, UBYTE *filename, const UBYTE *lable)
{
WORD button;
UBYTE *p;
PATH l_path;
FILENAME l_name;
if (fsel==NULL)
fsel = &default_fsel;
strcpy(l_path, fs_path);
p = strrchr (l_path, '\\');
strcpy((p+1), fsel->suffix);
strcpy(l_name, fsel->name);
Wake_mouse();
/* wind_update(BEG_UPDATE);*/
/* wind_update(BEG_MCTRL);*/
if (ext_fsel || gem >= 0x140 && gem < 0x200 || gem >= 0x300)
fsel_exinput (l_path, l_name, &button, (UBYTE*)lable);
else
fsel_input (l_path, l_name, &button);
/* wind_update(END_MCTRL);*/
/* wind_update(END_UPDATE);*/
if (button != 0)
{
p = strrchr (l_path, '\\');
strcpy(fsel->suffix, (UBYTE *)p+1);
p[1] = EOS;
make_normalpath(l_path,FALSE);
strcpy(fsel->name, l_name);
strcpy (filename, l_path);
strcat (filename, l_name);
if (!caseSens(filename, NULL))
str_upper(filename);
set_fsel_path(l_path); /* aktuellen Pfad im GEMDOS ändern */
}
else
filename[0] = EOS; /* Abbruch gedrückt */
return (*l_name && (button !=0) );
} /* select_file */
/***************************************************************************/
UBYTE **select_mfile (FSEL *fsel, UBYTE *path, const UBYTE *lable, WORD *anz)
{
BOOLEAN slct;
slct = slct_morenames(CMD_FILES_OUT, MFILE_ANZ, slct_files);
if (select_file (fsel, path, lable))
{
if (slct)
*anz = slct_getnum();
else
*anz = 1;
}
else
*anz = 0;
return (*anz > 1) ? slct_files : NULL;
}
/***************************************************************************/
/* Initialisieren des Moduls */
/***************************************************************************/
VOID init_global (VOID)
{
WORD work_out[57], i, f_anz;
WORD work_outx[57];
WORD ret;
Arrow_mouse();
phys_handle = graf_handle (&sys_wchar, &sys_hchar, &sys_wbox, &sys_hbox);
wind_get (0, WF_WORKXYWH, &desk.x, &desk.y, &desk.w, &desk.h);
gdos = vq_gdos(); /* GDOS vorhanden */
ext_fsel = fsel_check(); /* erweiterte FselBox */
if (ext_fsel)
{
for (i = 0; i < MFILE_ANZ; i++)
{
slct_files[i] = (UBYTE *) Malloc(sizeof(PATH));
strcpy(slct_files[i], "");
}
}
done = FALSE;
default_fsel.name[0] = EOS;
strcpy(default_fsel.suffix,"*.*");
get_path(fs_path, 0); /* Aktuellen Pfad holen */
strcat (fs_path, "*.*"); /* für FileselctBox */
vdi_handle = open_vwork(work_out);
fill_color = WHITE;
clip_flag = TRUE;
vq_extnd (vdi_handle, FALSE, work_outx); /* So, wg. Fehler im VDI */
f_anz = work_outx[10];
vq_extnd (vdi_handle, TRUE, work_outx);
planes = work_outx[4];
if (gdos)
f_anz += vst_load_fonts (vdi_handle, 0);
vswr_mode(vdi_handle, MD_REPLACE);
vsl_color (vdi_handle, BLACK);
vsl_ends (vdi_handle, SQUARE, SQUARE);
vsl_width (vdi_handle, 1);
vst_alignment(vdi_handle, TA_LEFT, TA_TOP, &ret, &ret);
get_systemfont(f_anz);
if (!getcookie('_IDT', &_idt)) /* Format für Datum und Zeit */
_idt = 0x0000112E; /* DD.MM.YYYY HH:MM:SS */
} /* init_global */
/************************************************************************/
/* Terminieren des Moduls */
/************************************************************************/
VOID term_global(VOID)
{
if (ext_fsel)
{
WORD i;
for (i = 0; i < MFILE_ANZ; i++)
Mfree(slct_files[i]);
}
if (gdos)
vst_unload_fonts (vdi_handle, 0);
v_clsvwk(vdi_handle);
}